Skip to content

[bug] else block for X_original when self.auto_scaler is false#21

Open
awlange wants to merge 1 commit intosquare:masterfrom
awlange:bug-x_original
Open

[bug] else block for X_original when self.auto_scaler is false#21
awlange wants to merge 1 commit intosquare:masterfrom
awlange:bug-x_original

Conversation

@awlange
Copy link

@awlange awlange commented Feb 8, 2020

For the NonLinearCoxPHModel class, when self.auto_scaler is set to False, the code raises an UnboundLocalError exception like the following:

  File ".../pysurvival/models/semi_parametric.py", line 610, in fit
    X_original = X_original[order, :]
UnboundLocalError: local variable 'X_original' referenced before assignment

This pull request is a simple fix that avoids the exception with an else block, assigning X_original to the non-transformed input X.

Without this bug fix, self.auto_scaler must always be True, which forces the user into applying a the default sklearn StandardScaler to the input. But this may not always be a desirable transformation, for example, with binary or categorical/ordinal features.

Hope this is a welcome bug fix! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant